import { Common_UIPath } from "../../common/Common_Define";
import { MVC } from "../../framework/MVC";
import { UIManager } from "../../framework/UIManager";
import AdManager from "../../manager/AdManadgr";
import { GameVoManager } from "../../manager/GameVoManager";
import { Manager } from "../../manager/Manager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class GuajiSelected extends MVC.BaseView {
    protected changeListener(enable: boolean): void {
    }

    /*
     * 关闭界面回调，每次打开只调用一次
     */
    public onClose(): void {
        super.onClose();
        // Manager.audio.playAudio(501);
        UIManager.Open(Common_UIPath.GuajiView);
    }

    onGuaji1() {
        GameVoManager.getInstance.myUserVo.guaji5bei = false;
        this.guaji();
    }

    onGuaji2() {
        AdManager.inst.playReward(() => {
            GameVoManager.getInstance.myUserVo.guaji5bei = true;
            this.guaji();
        })
    }

    guaji() {
        GameVoManager.getInstance.myUserVo.guajiTime = Date.now(); // 获取当前时间戳
        this.onClose();
    }
}